<?php

namespace api\models;

use Yii;
use yii\web\Link; // represents a link object as defined in JSON Hypermedia API Language.
use yii\web\Linkable;
use yii\helpers\Url;
/**
 * This is the model class for table "sshop_region".
 *
 * @property int $region_id
 * @property int $parent
 * @property string $region_name
 * @property int $region_type
 * @property int $agency_id
 */
class Region extends \yii\db\ActiveRecord implements Linkable
{
    public function getLinks()
    {
        return [
            Link::REL_SELF => Url::to(['user/view', 'id' => $this->region_id], true),
            'edit' => Url::to(['user/view', 'id' => $this->region_id], true),
            'profile' => Url::to(['user/profile/view', 'id' => $this->region_id], true),
            'index' => Url::to(['users'], true),
        ];
    }
    public function fields() {
        return [
            'region_name'
        ];
    }
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sshop_region';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['parent', 'region_type', 'agency_id'], 'integer'],
            [['region_name'], 'string', 'max' => 120],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'region_id' => 'Region ID',
            'parent' => 'Parent',
            'region_name' => 'Region Name',
            'region_type' => 'Region Type',
            'agency_id' => 'Agency ID',
        ];
    }
}
